from util.StringUtil import random_string
class Admin:
    def __init__(self,name):
        self.name=name
        self.node=None

    def set_node(self,node):
        self.node=node

    def generate_common_data(self,number):
        """
        生成number个公共数据，格式为'same_data':<number>，写入数据时
        也采用Hash算法
        :param number:
        :return: 返回生成的结果
        """
        result=[]
        for i in range(int(number)):
            key='same_data:'+str(i)
            value=key+':'+random_string(30)
            result.append((key,value))
            self.node.set(key,value)
